package com.library.controller;


import com.library.common.base.ApiResult;
import com.library.common.entity.MyPage;
import com.library.entity.FeedBack;
import com.library.entity.ResourceAudit;
import com.library.entity.dto.FeedBackDto;
import com.library.entity.dto.ResourceAuditDto;
import com.library.service.FeedBackService;
import com.library.service.ResourceAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 反馈信息表 前端控制器
 * </p>
 *
 * @author ccl
 * @since 2025-02-19
 */
@RestController
@RequestMapping("/api/feed-back")
@Api(tags = "我要反馈", value = "我要反馈相关接口")
public class FeedBackController {

    @Resource
    private FeedBackService feedBackService;

    @ApiOperation(value = "分页查询")
    @PostMapping("/queryPage")
    public ApiResult<MyPage<FeedBack>> queryPage(@RequestBody FeedBackDto dto) {
        return ApiResult.ok(feedBackService.queryPage(dto));
    }

    @ApiOperation(value = "详情")
    @GetMapping("/{id}")
    public ApiResult getById(@PathVariable("id") Long id) {
        return ApiResult.ok(feedBackService.detail(id));
    }

    @ApiOperation(value = "新增")
    @PostMapping("/add")
    public ApiResult save(@RequestBody FeedBack dto) {
        return ApiResult.ok(feedBackService.add(dto));
    }

    @ApiOperation(value = "修改")
    @PostMapping("/edit")
    public ApiResult edit(@RequestBody FeedBack dto) {
        return ApiResult.ok(feedBackService.edit(dto));
    }

    @ApiOperation(value = "删除")
    @GetMapping("/delete")
    public ApiResult delete(Long id) {
        return ApiResult.ok(feedBackService.delete(id));
    }
}

